﻿using Framework.Core.CommandLine;
using Framework.Core.Process;

namespace Framework.Core.BootStrapper.WindowsService
{
    public class WindowsServiceArgs : PluginCommandLineArgs, IWindowsServiceArgs
    {
        [CommandLineArgs(
            ShortName = "C",
            Name = "ConsoleMode",
            ArgumentRequirements = ArgumentRequirements.Optional
            )]
        public bool IsConsoleMode { get; set; }

        [CommandLineArgs(
            ShortName = "Env",
            Name = "Environment",
            ArgumentRequirements = ArgumentRequirements.Optional,
            DefaultValue = EnvMode.Dev
            )]
        public EnvMode Environment { get; set; }

        [CommandLineArgs(
            ArgumentRequirements = ArgumentRequirements.Optional,
            Name = "Install",
            ShortName = "I",
            DefaultValue = false)]
        public bool IsInstallMode { get; set; }

        [CommandLineArgs(
            ArgumentRequirements = ArgumentRequirements.Optional,
            Name = "Uninstall",
            ShortName = "U",
            DefaultValue = false)]
        public bool IsUninstallMode { get; set; }

        private string name;

        [CommandLineArgs(
            ArgumentRequirements = ArgumentRequirements.Optional,
            Name = "Name",
            ShortName = "n",
            DefaultValue = "")]

        public string Name
        {
            get
            {
                return string.IsNullOrWhiteSpace(name) ? Plugin : name;
            }
            set { name = value; }
        }

        private string displayName;

        [CommandLineArgs(
            ArgumentRequirements = ArgumentRequirements.Optional,
            Name = "DisplayName",
            ShortName = "dn",
            DefaultValue = "")]
        public string DisplayName
        {
            get
            {
                return string.IsNullOrWhiteSpace(displayName) ? Plugin : displayName;
            }
            set { displayName = value; }
        }

        [CommandLineArgs(
            ArgumentRequirements = ArgumentRequirements.Optional,
            Name = "User",
            ShortName = "usr",
            DefaultValue = "")]
        public string User { get; set; }

        [CommandLineArgs(
            ArgumentRequirements = ArgumentRequirements.Optional,
            Name = "Password",
            ShortName = "pwd",
            DefaultValue = "")]
        public string Password { get; set; }

        [CommandLineArgs(
            ArgumentRequirements = ArgumentRequirements.Optional,
            Name = "Args",
            ShortName = "a",
            DefaultValue = "")]
        public string Args { get; set; }

        public override string ToString()
        {
            return Name;
        }
    }
}